package day12;

public class Runthreads {
	public static void main(String[] args) {
		Runthreads rt = new Runthreads();
//		rt.runBasics();
		
		rt.checkThreadState1();
	}
	
	private void runBasics() {
		DeamonThread demon = new DeamonThread();
		demon.setDaemon(true);
		demon.start();
	}
	/**
	 * vid method 
	 */
	private void checkThreadState1() {
		SleepThread thread = new SleepThread(2000);
		try {
			System.out.println("thread state= before start = " + thread.getState());
			thread.start();
			
			System.out.println("thread state(after start) = " + thread.getState());
			
			Thread.sleep(1000);
			
			System.out.println("thread state(after 1sec) = " + thread.getState());
			thread.join();
			System.out.println("thread state(after Join) = " + thread.getState());
			
			thread.interrupt();
			System.out.println("thread state(after Interrupt) = " + thread.getState());
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
